import { getIntl, request } from "@umijs/max";
import qs from 'qs';



//通用规则
export async function createUser(params: any): Promise<BackendResponse<any>> {
    let url ='/admin-api/system/user/create';
    return request(url, {
        method: 'POST',
        data: params,

    });
}

export async function getUserById(id: string): Promise<BackendResponse<any>> {
    let url =`/admin-api/system/user/get`;
    return request(url, {
        method: 'GET',
        params: { id }
    });
}


export async function updateUser(params: any): Promise<BackendResponse<any>> {
    let url =`/admin-api/system/user/update`;
    return request(url, {
        method: 'PUT',
        data: params,
    });
}

export async function deleteUser(id: any): Promise<BackendResponse<any>> {
    let url =`/admin-api/system/user/delete/${id}`;
    return request(url, {
        method: 'DELETE'       
    });
}

export async function updateUserStatus(data:any): Promise<BackendResponse<any>> {
    let url =`/admin-api/system/user/update-status`;
    return request(url, {
        method: 'PUT',
        data: data,
    });
}

export async function updateUserPassword(data:any): Promise<BackendResponse<any>> {
    let url =`/admin-api/system/user/update-password`;
    return request(url, {
        method: 'PUT',
        data: data,
    });
}


export async function resetUserPassword(id:any): Promise<BackendResponse<any>> {
    let url =`/admin-api/system/user/reset-password/${id}`;
    return request(url, {
        method: 'PUT',
    });
}


export async function pageUsers(params: any): Promise<BackendResponse<any>> {
    let url ='/admin-api/system/user/page';
    return request(url, {
        method: 'POST',
        data: params,
    });
}

